﻿''' <summary>Generic Calendar schema</summary>
Public Class Calendar
    Inherits Indexable



    Public Sub New(ByVal content As String, ByVal format As IndexFormats, ByVal uri As String, ByVal modifed As Date, ByVal startDate As Date, ByVal endDate As Date)
        MyBase.New(content, format)
        Me._uri = uri
        Me._last_modified_time = modifed
        Me._start_date = startDate
        Me._end_date = endDate

    End Sub


    ''' <summary>Unique identifier </summary>
    ''' <remarks> required  </remarks>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _uri As String
    ''' <summary>Time last modified </summary>
    ''' <remarks> required  </remarks>
    Private _last_modified_time As Date
    ''' <summary>Meeting start date </summary>
    ''' <remarks> required  </remarks>
    Private _start_date As Date
    ''' <summary>Meeting end date </summary>
    ''' <remarks> required  </remarks>
    Private _end_date As Date



    ''' <summary>Title </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _title As String
    ''' <summary>Folder name </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _folder_name As String
    ''' <summary>Meeting attendees </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _attendees As String
    ''' <summary>Meeting categories </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _categories As String
    ''' <summary>Meeting duration (in minutes) </summary>
    <MarshalAs(UnmanagedType.U4)> _
    Private _duration As Integer
    ''' <summary>Meeting organizer </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _organizer As String
    ''' <summary>Meeting location </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _location As String

    ''' <summary>Describes how this appointment repeats </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _recurrence_pattern As String




    ''' <summary>Meeting attendees </summary>
    Public Property Attendees() As String
        Get
            Return _attendees
        End Get
        Set(ByVal value As String)
            _attendees = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Meeting categories </summary>
    Public Property Categories() As String
        Get
            Return _categories
        End Get
        Set(ByVal value As String)
            _categories = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Meeting duration (in minutes) </summary>
    Public Property Duration() As Integer
        Get
            Return _duration
        End Get
        Set(ByVal value As Integer)
            _duration = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Meeting end date </summary>
    ''' <remarks> required  </remarks>
    Public ReadOnly Property End_date() As Date
        Get
            Return _end_date
        End Get
    End Property
    ''' <summary>Folder name </summary>
    Public Property Folder_name() As String
        Get
            Return _folder_name
        End Get
        Set(ByVal value As String)
            _folder_name = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Time last modified </summary>
    ''' <remarks> required  </remarks>
    Public ReadOnly Property Last_modified_time() As Date
        Get
            Return _last_modified_time
        End Get
    End Property
    ''' <summary>Meeting location </summary>
    Public Property Location() As String
        Get
            Return _location
        End Get
        Set(ByVal value As String)
            _location = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Meeting organizer </summary>
    Public Property Organizer() As String
        Get
            Return _organizer
        End Get
        Set(ByVal value As String)
            _organizer = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Describes how this appointment repeats </summary>
    Public Property Recurrence_pattern() As String
        Get
            Return _recurrence_pattern
        End Get
        Set(ByVal value As String)
            _recurrence_pattern = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Meeting start date </summary>
    ''' <remarks> required  </remarks>
    Public ReadOnly Property Start_date() As Date
        Get
            Return _start_date
        End Get
    End Property
    ''' <summary>Title </summary>
    Public Property Title() As String
        Get
            Return _title
        End Get
        Set(ByVal value As String)
            _title = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Unique identifier </summary>
    ''' <remarks> required  </remarks>
    Public ReadOnly Property Uri() As String
        Get
            Return _uri
        End Get
    End Property



    Protected Overrides Sub AddRequredProperties(ByVal e As [Event])
        MyBase.AddRequredProperties(e)


        e.AddProperty("uri", Me._uri)
        e.AddProperty("last_modified_time", Me._last_modified_time.ToOADate)
        e.AddProperty("start_date", Me._start_date.ToOADate)
        e.AddProperty("end_date", Me._end_date.ToOADate)


    End Sub

    Protected Overrides Sub AddOtherProperties(ByVal e As [Event])
        MyBase.AddOtherProperties(e)



        If Not String.IsNullOrEmpty(Me._title) Then
            e.AddProperty("title", Me._title)

        End If

        If Not String.IsNullOrEmpty(Me._folder_name) Then
            e.AddProperty("folder_name", Me._folder_name)
        End If

        If Not String.IsNullOrEmpty(Me._attendees) Then e.AddProperty("_attendees", Me._attendees)

        
        If Not String.IsNullOrEmpty(Me._categories) Then e.AddProperty("categories", Me._categories)

        e.AddProperty("duration", Me._duration)

        If Not String.IsNullOrEmpty(Me._organizer) Then e.AddProperty("organizer", Me._organizer)

        If Not String.IsNullOrEmpty(Me._location) Then e.AddProperty("location", Me._location)


        If Not String.IsNullOrEmpty(Me._recurrence_pattern) Then e.AddProperty("recurrence_pattern", Me._recurrence_pattern)



    End Sub



    'Protected Overrides Function GetMyEvent(ByVal id As String) As [Event]
    '    Return New [Event](id, GetType(Calendar).FullName)

    'End Function

End Class

